"use strict"

const videoPlay=document.querySelector("video#player")
const gotMediaStream=(stream)=>{
    videoPlay.srcObject=stream
} 

const handleError=(err)=>{
    console.log(err)
}

if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){
    console.log("getUserMedia is not supported!")
}else{
    let contraints={
        video:false,
        audio:true
    }
    navigator.mediaDevices.getUserMedia(contraints).then(
        gotMediaStream
    ).catch(handleError)
}